import { request } from '@/utils/request.js'

/**
 * 任务 API JS
 */

export default {
  /**
   * 获取列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'sea/waybillTask/index',
      method: 'get',
      params
    })
  },

   /**
   * 读取任务
   * @returns
   */
   read (id) {
    return request({
      url: 'sea/waybillTask/read/' + id,
      method: 'get',
    })
  },
  /**
   * 添加
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'sea/waybillTask/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新运单数据
   * @returns
   */
  update (data = {}) {
    return request({
      url: 'sea/waybillTask/update/' + data.id,
      method: 'put',
      data
    })
  },
  //审核通过
  review(data = {}) {
      return request({
          url: '/sea/waybillTask/review',
          method: 'post',
          data
      })
  },
  //驳回
  turndown(data = {}) {
    return request({
        url: '/sea/waybillTask/turndown',
        method: 'post',
        data
    })
  },
  //出库
  outwarehouse(data = {}) {
    return request({
        url: '/sea/waybillTask/outwarehouse',
        method: 'post',
        data
    })
  },
  //完成
  close(data = {}) {
    return request({
        url: '/sea/waybillTask/close',
        method: 'post',
        data
    })
  },
  //待结算
  pendingSettlement(data = {}) {
      return request({
          url: '/sea/waybillTask/pendingSettlement',
          method: 'post',
          data
      })
  },
  //结算
  settlement(data = {}) {
      return request({
          url: '/sea/waybillTask/settlement',
          method: 'post',
          data
      })
  },
  //作废
  void(data = {}) {
      return request({
          url: '/sea/waybillTask/void',
          method: 'post',
          data
      })
  },
  
    /**
   * 任务消息列表
   * @returns
   */
    getListMsg (params = {}) {
      return request({
        url: 'sea/waybillTaskMessage/list',
        method: 'get',
        params
      })
    },
  /**
     * 任务消息删除
     * @returns
     */
  deletesMsg(data) {
    return request({
        url: 'sea/waybillTaskMessage/delete',
        method: 'delete',
        data
    })
  },
  /**
   * 任务消息保存
   * @returns
   */
  saveMsg (data = {}) {
    return request({
      url: 'sea/waybillTaskMessage/save',
      method: 'post',
      data
    })
  },
   /**
   * 运单分配出库单
   * @returns
   */
   AssignOutOrder (data = {}) {
    return request({
      url: 'sea/waybillList/AssignOutOrder',
      method: 'post',
      data
    })
  },
  /**
   * 站内任务完成
   * @returns
   */
  complete (data = {}) {
    return request({
      url: 'sea/waybillTask/complete',
      method: 'post',
      data
    })
  },
}